﻿@namespace BootstrapBlazor.Components
@inherits PopoverCompleteBase<string>

@if (IsShowLabel)
{
    <BootstrapLabel required="@Required" for="@InputId" ShowLabelTooltip="ShowLabelTooltip" Value="@DisplayText" />
}
<div class="@ClassString" id="@Id">
    <input @attributes="AdditionalAttributes" id="@InputId" class="@ClassName" autocomplete="off" type="@Type" data-bs-toggle="@ToggleString" data-bs-placement="@PlacementString" data-bs-offset="@OffsetString" data-bs-custom-class="@CustomClassString" placeholder="@PlaceHolder" disabled="@Disabled" data-bb-debounce="@DurationString" @bind-value="@CurrentValueAsString" @bind-value:event="oninput" @onblur="OnBlur" @onfocus="OnFocus" @ref="FocusElement" />
    <span class="form-select-append"><i class="@Icon"></i></span>
    <span class="form-select-append ac-loading"><i class="@LoadingIcon"></i></span>
    <ul class="dropdown-menu">
        @if (FilterItems.Any())
        {
            @foreach (var item in FilterItems)
            {
                <li @key="item" class="dropdown-item" @onmousedown="() => OnClickItem(item)">
                    @if (ItemTemplate == null)
                    {
                        <div>@item</div>
                    }
                    else
                    {
                        @ItemTemplate(item)
                    }
                </li>
            }
        }
        else
        {
            <li class="dropdown-item">@NoDataTip</li>
        }
    </ul>
</div>
